import { Colors, ColorUtil } from "./util/ColorUtil";
import { debugMgr } from "./DebugMgr";
import { EventId, eventMgr } from "./EventMgr";
import { layerMgr, ViewLayer } from "./LayerMgr";
import { StrUtil } from "./util/StrUtil";
import { Views } from "../cfg/XlsxDef";

/**
 * 弹出管理
 */
export const popupMgr = _ as PopupMgr;
export class PopupMgr {

    init() {
        (popupMgr as any) = this;
        layerMgr.open(Views.TipView, _, ViewLayer.Tip);
    }

    /**
     * 飘字
     */
    showFloatText(str: string, color: string = Colors.Green) {
        eventMgr.send(EventId.floatText, StrUtil.makeOutline(StrUtil.makeColor(str, color)));
    }

    /**
     * 调试飘字
     */
    showFloatTextDebug(str: string, color?: string) {
        debugMgr.isDebug && this.showFloatText(str, color);
    }

}

declare global {
    interface EventData {
        [EventId.floatText]: string,
    }
}